package com.codemonkey.lq.extend.utils.excelverification;

import com.codemonkey.lq.extend.excelverification.AbstractVerifier;
import com.codemonkey.lq.extend.excelverification.CellContext;

public final class MyVerifier extends AbstractVerifier {

	private String fieldName;

	@Override
	protected boolean doVerify(final CellContext cellContext) {
		fieldName = cellContext.getCellName();

		Object val = cellContext.getCellVal();
		if (null == val) {
			cellContext.addErrorMsg("can not be null");
			return false;
		}

		int fxVal = Integer.parseInt(cellContext.getRowContext().get("FX").toString());
		if (fxVal < Integer.parseInt(val.toString())) {
			cellContext.setCellVal(Integer.parseInt(val.toString()));
			return true;
		} else {
			cellContext.addErrorMsg(" [FX] can not big than [ $val ]");
			return false;
		}

	}

	@Override
	public String getReadableFailMsg(CellContext cellContext) {
		return "fieldName : [ " + fieldName + " ] this is my test; you can be here";
	}

}
